// 协议管理相关类型定义

// 协议信息接口
export interface ProtocolInfo {
  protocolId: string | number
  protocolName: string
  productName: string
  protocolVersion: string
  communicationType: 'HTTP' | 'MQTT' | 'TCP' | 'UDP'
  encoding: string
  status: string
  remark?: string
  createTime?: string
  updateTime?: string
  // 保留原有字段以兼容详情页面
  protocolCode?: string
  protocolType?: string
  transport?: string
  dataFormat?: string
  version?: string
  iconUrl?: string
  port?: number
  timeout?: number
  description?: string
  configInfo?: {
    retryCount?: number
    heartbeatInterval?: number
    bidirectional?: boolean
    batchOperation?: boolean
  }
  parseRule?: {
    parseMethod: string
    parseScript?: string
    parseTemplate?: string
  }
}

// 协议查询参数
export interface ProtocolQueryParams {
  pageNum: number
  pageSize: number
  productName?: string
  protocolVersion?: string
  protocolVersionName?: string
  communicationType?: string
  status?: string
  protocolName?: string
  protocolCode?: string
  protocolType?: string
  transport?: string
}

// 协议列表响应
export interface ProtocolListResponse {
  code: number
  msg: string
  rows: ProtocolInfo[]
  total: number
}

// 协议详情响应
export interface ProtocolDetailResponse {
  code: number
  msg: string
  data: ProtocolInfo
}

// 协议操作响应
export interface ProtocolOperationResponse {
  code: number
  msg: string
  data?: any
}

// 协议表单数据接口
export interface ProtocolFormData {
  protocolId?: string | number
  productId: string | undefined
  productName: string
  protocolName: string
  protocolVersion: string
  communicationType: 'HTTP' | 'MQTT' | 'TCP' | 'UDP' | undefined
  encoding: string | undefined
  status: string | undefined
  remark?: string
}